import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:landlore/screens/homePage.dart';
import 'package:syncfusion_localizations/syncfusion_localizations.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: const Size(412,892),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (context,child){
        return MaterialApp(
          localizationsDelegates:  const [
            GlobalMaterialLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,

            SfGlobalLocalizations.delegate
          ],
          supportedLocales:  const [
            Locale('en', 'US'), // 英文（美国）
            Locale('es', 'ES'), // 西班牙语（西班牙）
            Locale('fr', 'FR'), // 法语（法国）
            Locale('de', 'DE'), // 德语（德国）
            Locale('zh', 'CN'), // 中文（中国）
            Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
            Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
            Locale.fromSubtags(languageCode: 'en')
            // ... other locales the app supports
          ],
          // locale: const Locale('en'),
          title: 'Landlore',
          theme: ThemeData(
            primarySwatch: Colors.blue,
            appBarTheme: const AppBarTheme(backgroundColor: Color(0xffe9c46a)),
          ),
          home: MediaQuery(
            ///设置文字大小不随系统设置改变
            data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
            child: HomePage(),
          ),
        );
      },
    );
  }
}

